﻿namespace BlogsAPI.Search
{
    using System;
    using Newtonsoft.Json;

    /// <summary>
    /// The Twitter Search Result class.
    /// </summary>
    [Serializable]
    [JsonObject(MemberSerialization = MemberSerialization.OptIn)]
    public class SearchResult
    {
        /// <summary>
        /// Тип объяекта по классификации гугла
        /// </summary>
        [JsonProperty(PropertyName = "GsearchResultClass")]
        public string GsearchResultClass { get; set; }

        /// <summary>
        /// ссылка на сам сблог
        /// </summary>
        [JsonProperty(PropertyName = "blogUrl")]
        public string blogUrl { get; set; }

        /// <summary>
        /// Ссылка на пост
        /// </summary>
        [JsonProperty(PropertyName = "unescapedUrl")]
        public string postUrl { get; set; }

        /// <summary>
        ///  Если нету unescapedUrl
        /// </summary>
        [JsonProperty(PropertyName = "postUrl")]
        public string _postUrl { get { return postUrl; } set { postUrl = value; }}

        /// <summary>
        /// Для GwebSearch
        /// </summary>
        [Obsolete]
        [JsonProperty(PropertyName = "url")]
        public string Url { get { return postUrl; } set { postUrl = value; } }

        /// <summary>
        /// Для GwebSearch
        /// </summary>
        [Obsolete]
        [JsonProperty(PropertyName = "visibleUrl")]
        public string VisibleUrl { get { return blogUrl; } set { blogUrl = value; } }

        [JsonProperty(PropertyName = "publishedDate")]
        public DateTime publishedDate { get; set; }

        [JsonProperty(PropertyName = "titleNoFormatting")]
        public string titleNoFormatting { get; set; }

        [JsonProperty(PropertyName = "content")]
        public string content { get; set; }

        /// <summary>
        /// Название блога
        /// </summary>
        [JsonProperty(PropertyName = "author")]
        public string author { get; set; }
    }
}
